﻿@model GSLMS.Entity.TB_APP_REGINFO
@{
    Layout = null;
    var ddlSource = ViewData["Source"] as SelectList;
    var ddlMediator = ViewData["Mediator"] as SelectList;
    var ddlBussType = ViewData["BussType"] as SelectList;
    var ddlProduct = ViewData["Product"] as SelectList;
    var ddlImportantLevel = ViewData["ImportantLevel"] as SelectList;
}
<div class="pageContent">
    <form method="post" action="DianDang/Apply/ApplyList/Create?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return SumbitForm(this)">
    @Html.ValidationSummary(true)
    <div class="pageFormContent" layouth="56">
        @Html.HiddenFor(model => model.ID)
        <p>
            <label>
                客户名称：</label>
            @Html.TextBoxFor(model => model.CUSTNAME, new { @class = "required" })
            @Html.ValidationMessageFor(model => model.CUSTNAME)
        </p>
        <p>
            <label>
                证件号码：</label>
            @Html.TextBoxFor(model => model.CUSTNO, new { @class = "required" })
            @Html.ValidationMessageFor(model => model.CUSTNAME)
            @* <a class="button" href="javascript:;"><span>验证</span></a>*@
        </p>
        <p>
            <label>
                联系人：</label>
            @Html.TextBoxFor(model => model.LINKMAN, new { @class = "" })
            @Html.ValidationMessageFor(model => model.LINKMAN)
        </p>
        <p>
            <label>
                联系人手机：</label>
            @Html.TextBoxFor(model => model.LINKMANTEL, new { @class = "tel" })
            @Html.ValidationMessageFor(model => model.LINKMANTEL)
        </p>
        <p>
            <label>
                来源渠道：</label>
            @Html.DropDownListFor(model => model.SOURCE, ddlSource, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "combox", @selectedvalue = Model.SOURCE })
            @Html.ValidationMessageFor(model => model.SOURCE)
        </p>
        <p>
            <label>
                中介人：</label>
            @Html.DropDownListFor(model => model.MEDIATORID, ddlMediator, new { @class = "combox tRequired", @selectedvalue = Model.MEDIATORID, @target = "SOURCE", @targetValue = "中介介绍", @sumbitText = "Mediator" })
            @Html.ValidationMessageFor(model => model.MEDIATORID)
        </p>
        <p>
            <label>
                外地项目：</label>
            @Html.CheckBox("FIELDPROJECT", Model.FIELDPROJECT == 1 ? true : false, new { @value = "1" })
            @Html.ValidationMessageFor(model => model.FIELDPROJECT)
        </p>
        <p>
            <label>
                业务种类：</label>
            @Html.DropDownListFor(model => model.BUSSTYPE, ddlBussType, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "combox required", @selectedvalue = Model.BUSSTYPE })
            @Html.ValidationMessageFor(model => model.BUSSTYPE)
        </p>
        <p>
            <label>
                贷款产品：</label>
            @Html.DropDownListFor(model => model.PRODUCTID, ddlProduct, new { @class = "combox", @sumbitText = "ProductName", @selectedvalue = Model.PRODUCTID })
            @Html.ValidationMessageFor(model => model.CUSTNAME)
        </p>
        <p>
            <label>
                贷款期限：</label>
            @Html.TextBoxFor(model => model.LOANPHASE, new { @class = "number" })
            @Html.ValidationMessageFor(model => model.LOANPHASE)
            @Html.RadioButtonFor(model => model.LOANPHASETYPE, 0)
            天&nbsp;
            @Html.RadioButtonFor(model => model.LOANPHASETYPE, 1)
            月
        </p>
        <p>
            <label>
                登记时间：</label>
            @Html.TextBoxFor(model => model.REGDATE, new { @class = "required", @readonly = "true", formatDate = "yyyy-MM-dd" })
            @Html.ValidationMessageFor(model => model.REGDATE)
        </p>
        <p>
            <label>
                登记人：</label>
            @Html.TextBoxFor(model => model.REGMAN, new { @class = "", @readonly = "true" })
            @Html.ValidationMessageFor(model => model.REGMAN)
        </p>
        <p>
            <label>
                意向贷款金额：</label>
            @Html.TextBoxFor(model => model.INTEMTIONAMT, new { @class = "required number" })
            <span>&nbsp;万元</span>
            @Html.ValidationMessageFor(model => model.INTEMTIONAMT)
        </p>
        <p>
            <label>
                重要级别：</label>
            @Html.DropDownListFor(model => model.IMPORTANTLEVEL, ddlImportantLevel, new { @class = "combox", @selectedvalue = Model.IMPORTANTLEVEL })
            @Html.ValidationMessageFor(model => model.IMPORTANTLEVEL)
        </p>
        <div class="divider">
        </div>
        <p style="width: 90%">
            <label>
                详细内容：</label>
            @Html.TextAreaFor(model => model.REMARK, new { @cols = "70", @rows = "5" })
            @Html.ValidationMessageFor(model => model.REMARK)
        </p>
    </div>
    @Html.Partial("FormButtonBar")
    </form>
</div>
<script>
    function SumbitForm(obj) {
        var id = $("#ID").val();
        var custNo = $("#CUSTNO").val();
        // var systemID = $("#SYSTEMID").val();

        $.ajax({
            type: 'POST',
            url: "DianDang/Apply/ApplyList/IsCustExitsed",
            data: { ID: id, CUSTNO: custNo },
            cache: false,
            success: function (response) {
                var json = DWZ.jsonEval(response);

                if (json.statusCode == DWZ.statusCode.error) {
                    if (json.message) alertMsg.error(json.message);
                }
                else
                    validateCallback(obj, dialogAjaxDone, json.message);

                if (json.statusCode == DWZ.statusCode.timeout) {
                    if ($.pdialog) $.pdialog.checkTimeout();
                    if (navTab) navTab.checkTimeout();

                    alertMsg.error(json.message || DWZ.msg("sessionTimout"), { okCall: function () { DWZ.loadLogin(); } });
                }
            }
        });
        return false;
    }
    
</script>
